-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
gh-116946: add Py_TPFLAGS_IMMUTABLETYPE
to _random.Random
#138341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one idea.
Wait, why is |
Probably because it would break code to change that. |
It became mutable in 3.9. I think this is a bug. |
I was also surprised but I just didn't want to break stuff here. |
Yes, I think adding IMMUTABLE flag was missed while conversion, it shouldn't be a mutable type. |
See #88074 where most of the converted types where made immutable, same should be done for random and epoll |
random.Random
Py_TPFLAGS_IMMUTABLETYPE
to _random.Random
@rhettinger Does this change satisfy you? do you want this to be backported? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please don't backport this change. It would be surprising that a class becomes immutable in 3.x.y bugfix release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I would prefer a single large PR that fixes the 3.9 error by making all converted types immutable.
On main the following leaks: